﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Fjaspx.Templet
{
    [DefaultProperty("")]
    [ToolboxData("<{0}:Link runat=server />")]
    public class Link : Literal
    {
        private string _Name = "FilePath";
        private string _Class = null;
        /// <summary>
        /// 字段名称
        /// </summary>
        /// <value>The name.</value>

        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }
        /// <summary>
        /// 参数值 只读 Request[ParameterName]
        /// </summary>
        /// <value>The id.</value> 
        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public string Class
        {
            get { return _Class; }
            set { _Class = value; }
        }
     
        /// <summary>
        /// 输出
        /// </summary>
        /// <param name="output">The output.</param>
        protected override void Render(HtmlTextWriter output)
        {
            Fjaspx.Sys.Bll.ROYcms_class ___ROYcms_class = new Fjaspx.Sys.Bll.ROYcms_class();

            try
            {
                output.Write(___ROYcms_class.GetClassField(Convert.ToInt32(Class), Name).Replace("{cmspath}/","/"));
            }
            catch { output.Write("<!--输出错误！-->"); }

        }
    }
}
